<?php

require_once($WSC->get_site_inc_dir().'modules/tangra_cms/_sys/tcms_admin_web_page_wed_ua.class.php');
require_once($WSC->get_site_inc_dir().'modules/tangra_cms/classes/rss/rss_channel_dbc.class.php');


class RSS_Channel_manage_WP extends TCMS_Admin_Web_Page_WED_UA {
	public function create_view($name = 'default') {
		$ret = new TCMS_Admin_Page_View($this, $name, 'modules/tangra_cms/pages/_rss/');

		return $ret;
	}


	public function init() {
		parent::init();

		$v = $this->create_view();
		$this->add_view($v);

		$this->wed->add_wed_event_action_pair(new Web_Event_Simple_Int('manage', Tangra_Parameter_Method::GET, 'manage'), 'manage_event');
	}


	protected function manage_event($rc_id) {
		$rc = new RSS_Channel_DBC();

		$dbc = $this->get_dbc();
		if ($rc->load_by_id($dbc, $rc_id)) {
			$this->export('rc', $rc);
			$view = $this->get_view('default');
		} else {
			$view = $this->create_redirect_view('record_not_found.php');
		}


		return $view;
	}


	protected function default_event() {
		throw new Tangra_Module_Exception('Expecting manage parameter.');
	}
}


